<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:HH="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="../static/js/jquery-1.8.2.min.js"></script>
</head>
<body>
<div class="container">
    <div class="navbar" style="border: 1px solid #ff0000">
        <img src="https://gcy-image.oss-cn-shanghai.aliyuncs.com/%E5%AE%9E%E8%AE%AD%E4%B8%80/duckandrabbit.gif" height="100%" width="100%">
    </div>
    <table class="table table-striped table-hover table-responsive">
        <tr th:each="list:${list}">
            <td class="col-md-2"><img th:src="${list.goodsImg}" alt="" width="100px" height="100px"></td>
            <td class="col-md-2" th:text="${list.goodsName}"></td>
            <td class="col-md-2" style="color: red;font-weight: bold" th:text="￥+${list.eventPrice}"></td>
            <td>
                <div class="progress">
                    <div class="progress-bar" role="progressbar" aria-valuenow="70"
                             aria-valuemin="0" aria-valuemax="100" style="width: 70%;height: 20px"
                        >70%</div>
                    </div>
            </td>
            <td class="col-md-2"><input type="button" value="抢购" th:onclick="seckill([[${list.startTime}]],[[${list.endTime}]],[[${list.middleId}]])"></td>
        </tr>
    </table>
    <div class="navbar" style="border: 1px solid #ff0000">
        <img src="https://gcy-image.oss-cn-shanghai.aliyuncs.com/%E5%AE%9E%E8%AE%AD%E4%B8%80/duckandrabbit1.gif" height="100%" width="100%">
    </div>
    <input type="button" value="点击" id="dj">
</div>
</body>
<script>
    function seckill(startTime,endTime,middleId) {
        var a = new Date(startTime);
        var b = new Date(endTime);
        var d = new Date();
        if (d.getTime()>a.getTime()&&d.getTime()<b.getTime()){
            location = "/order/goGoods?middleId="+middleId;
        }else if (d.getTime()<a.getTime()){
            alert("活动还没开始");
        }else if (d.getTime()>b.getTime()){
            alert("活动已经结束");
        }
    }

    $("#dj").click(function () {
        $.post(
            "/delayedMq",
            function (a){
                alert("开始");
            }
        )
    })
</script>
</html>
